<template>
    <div class="xl-table">
        <xlUntil text="在孵企业" :queryParam="queryParam" @addForm="addCompany" :add-btn="true" :import-btn="false" @searchKeyWord="searchKeyWord" @delBatch="delBatch" :searchColumns="columns">
            <template #search>
                <a-input v-model="queryParam.carrierName" placeholder="请输入载体名称"></a-input>
                <a-select v-model="queryParam.withInvestFlag" placeholder="是否为投融资企业" showSearch allowClear  style="margin-right: 16px;width: 200px;">
                    <a-select-option value="0">
                        否
                    </a-select-option>
                    <a-select-option value="1">
                        是
                    </a-select-option>
                </a-select>

                <a-select v-model="queryParam.withHighTechFlag" placeholder="是否为高企" showSearch allowClear  style="margin-right: 16px;width: 200px;">
                    <a-select-option value="0">
                        否
                    </a-select-option>
                    <a-select-option value="1">
                        是
                    </a-select-option>
                </a-select>

                <a-select v-model="queryParam.withProjectAwardFlag" placeholder="是否获得过市项目企业" showSearch allowClear  style="margin-right: 16px;width: 200px;">
                    <a-select-option value="0">
                        否
                    </a-select-option>
                    <a-select-option value="1">
                        是
                    </a-select-option>
                </a-select>
            </template>
        </xlUntil>
        <div class="xl-table-content">
            <xlTable
                    :columns="columns"
                    :dataSource="data"
                    rowKey="id"
                    :pagination="pagination"
                    :loading="loading"
                    @change="handleTableChange"
                    bordered
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
                >
                <template v-slot:action="scope">
                    <a @click="seeForm(scope.record)">查看</a>
                </template>
                <template v-slot:dupliCnt="scope">
                    <a @click="seeCodeForm(scope.record)" v-if="scope.record.dupliCnt">{{scope.record.dupliCnt | xln}}</a>
                    <span v-else>{{scope.record.dupliCnt | xln}}</span>
                </template>
            </xlTable>
        </div>
        <xlForm ref="xlForm" @handleOk="handleOk"></xlForm>
        <xlAdd @editForm="editForm" ref="xlAdd"></xlAdd>
        <seeForm ref="seeForm"></seeForm>
        <hatch_company_creditCode ref="hatch_company_creditCode"></hatch_company_creditCode>
    </div>
</template>

<script>

    import xlMixin from '../../../../components/mixin'
    import seeForm from './model/see'
    import xlForm from './model/form'
    import xlAdd from './model/add'
    import hatch_company_creditCode from '../../../../components/views/carrier/hatch_company_creditCode'
    export default {
        name: "index",
        mixins: [xlMixin],
        data() {
            return {
                columns: [
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width: '100px',
                        sorter: (a) => a.id,//排序
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '载体名称',
                        fixed: 'left',
                        width:'200px',
                        dataIndex: 'carrierName',
                        type:'input'
                    },
                    {
                        title: '企业名称',
                        dataIndex: 'comName',
                        fixed: 'left',
                        width:'175px',
                        type: 'input'
                    },
                    {
                        title: '重复挂靠',
                        dataIndex: 'dupliCnt',
                        fixed: 'left',
                        width:'120px',
                        type:'input.number',
                        scopedSlots: {customRender: 'dupliCnt'},
                    },
                    {
                        title: '入驻时间',
                        dataIndex: 'joinDate',
                        type: 'date'
                    },
                    {
                        title: '行业领域',
                        dataIndex: 'industryDomain',
                        width:'160px',
                        type: 'input'
                    },
                    {
                        title: '企业标签',
                        dataIndex: 'tagNames',
                        width:'150px',
                        type: 'input'
                    },
                    {
                        title: '员工人数',
                        dataIndex: 'employeeNum',
                        width:'150px',
                        type: 'input'
                    },
                    {
                        title: '是否空挂',
                        dataIndex: 'isEmptyHanging',
                        width:'150px',
                        type:'radio',
                        typeData:[
                            {
                                dataName:'是',
                                dataValue:true
                            },
                            {
                                dataName:'否',
                                dataValue:false
                            }
                        ]
                    },
                    {
                        title: '销售收入(万元)',
                        dataIndex: 'incomeAmt',
                        width:'150px',
                        type: 'input'
                    },
                    {
                        title: '纳税额(万元)',
                        dataIndex: 'taxAmt',
                        width:'150px',
                        type: 'input'
                    },
                    {
                        title: '自主知识产权申报量',
                        dataIndex: 'iprGrantNum',
                        type: 'input'
                    },
                    {
                        title: '自主知识产权授权量',
                        dataIndex: 'iprOwnedNum',
                        type: 'input'
                    },
                    {
                        title: '企业状态',
                        dataIndex: 'statusDesc',
                        width:'150px',
                        type: 'input'
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        fixed: 'right',
                        width: '150px',
                        scopedSlots: {customRender: 'action'},
                    }
                ],
                url: {
                    list: "/system/api/carrierComInfo/pageList",
                    add: '/system/api/carrierComMore/save',
                    edit: '/system/api/carrierComMore/save',
                    delete: "/system/api/carrierComInfo/remove",
                    deleteBatch: "/system/api/carrierComInfo/remove",
                    exportXlsUrl: "/system/api/carrierComInfo/exportExcel",
                    importExcelUrl: "/system/api/carrierComInfo/importExcel",
                    importExcelDemoUrl: "/system/api/carrierComInfo/importTemplate",
                }
            }
        },
        components: {
            xlForm,
            xlAdd,
            seeForm,
            hatch_company_creditCode
        },
        created() {
            this.formatMerge()
            this.pageOnload()
        },
        methods: {
            addCompany() {
                this.$refs.xlAdd.formatForm({})
                this.$refs.xlAdd.visible = true
            },
            editForm(data) {
                //修改方法
                this.$refs.xlForm.tableTitle = '修改'
                this.$refs.xlForm.formatForm(data)
                this.$refs.xlForm.confirmLoading = false
                this.$refs.xlForm.type = 2
            },
            seeCodeForm(data){
                this.$refs.hatch_company_creditCode.formatData(data)
            }
        }
    }
</script>

<style scoped lang="less">
    .xl-table {
        .xl-table-content {
            padding: 16px;
        }
    }
</style>
